package com.yupi.usercenter.feign.client;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.usercenter.base.model.Result;
import com.yupi.usercenter.basic.vo.SqNetworkPageVO;
import com.yupi.usercenter.feign.vo.SqNetworkByNameVO;
import com.yupi.usercenter.feign.vo.SqProxyAndFranchiseeNetworkVO;
import com.yupi.usercenter.feign.vo.SqProxyFinnetNetworkVO;
import com.yupi.usercenter.feign.vo.SqProxyNetworkVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


/**
 * 服务质量接口调用平台网关api
 *
 * @author zhuzhengjie
 */
@Component
@FeignClient(
        name = "ylnetworkapi",
        url = "http://127.0.0.1:8080",
        path = "/networkapi/web" + "/servicequality/network")
public interface SqNetworkFeignClient {

    /**
     * 分页获取网点信息SqProxyAndFranchiseeNetworkVO
     *
     * @return
     */
    @PostMapping("/page")
    //(value = "分页获取网点信息", notes = "分页获取网点信息")
    Result<Page<SqNetworkPageVO>> page(@RequestParam(value = "current", required = false, defaultValue = "1") Long current,
                                       @RequestParam(value = "size", required = false, defaultValue = "20") Long size);

    @PostMapping("/getProxyNetworkByIds")
    //(value = "批量查询网点所属代理点接口(非代理区返回代理网点,否则返回当前)", notes = "批量查询网点所属代理点接口(非代理区返回代理网点,否则返回当前)")
    Result<List<SqProxyNetworkVO>> getProxyNetworkByIds(@RequestBody List<Integer> networkIds);


    @GetMapping("/getNetworkById")
    //(value = "根据网点id查询网点信息", notes = "根据网点id查询网点信息")
    Result<SqNetworkPageVO> getNetworkById(@RequestParam int id);


    @PostMapping("/getNetworkByNames")
    //(value = "根据网点名称批量查网点所属上级", notes = "根据网点名称批量查网点所属上级")
    Result<List<SqNetworkByNameVO>> getNetworkByNames(@RequestBody List<String> networkNames);

    @GetMapping("/getAllNextDetailById")
    //(value = "根据网点id查询下级所有网点信息", notes = "根据网点id查询下级所有网点信息")
    Result<List<SqNetworkPageVO>> getAllNextDetailById(@RequestParam int id);

    @PostMapping("/getNetworkAgentInfoByIds")
    //(value = "根据网点ids查询网点信息且查询该网点代理区信息", notes = "根据网点ids查询网点信息且查询该网点代理区信息")
    Result<List<SqProxyFinnetNetworkVO>> getNetworkAgentInfoByIds(@RequestBody List<Integer> ids);

    @PostMapping("/getProxyAndFranchiseeByIds")
    //(value = "根据网点id批量查询代理区和加盟商")
    Result<Map<Integer, SqProxyAndFranchiseeNetworkVO>> getProxyAndFranchiseeByIds(@RequestBody List<Integer> ids);

    //(value = "查询所有代理区", notes = "查询所有代理区-包含百世")
    @PostMapping(value = "/getAllProxyNetworks")
    Result<List<SqProxyNetworkVO>> getAllProxyNetworks();

    //(value = "查询所有代理区", notes = "查询所有代理区-过滤百世")
    @PostMapping(value = "/getAllProxyNetworksNoBest")
    Result<List<SqProxyNetworkVO>> getAllProxyNetworksNoBest();
}
